/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-06-07     Wangjiangbo       the first version
 */
#include <bsp/bsp_spi.h>
#include <drv_spi.h>

#define DBG_TAG "spi"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>

int bsp_spi_init(void)
{
    __HAL_RCC_GPIOA_CLK_ENABLE();
    rt_hw_spi_device_attach(SPI_BUS_NAME, W25Q_SPI_DEVICE_NAME, GPIOA, GPIO_PIN_15);

//    struct rt_spi_device *handel = (struct rt_spi_device *)rt_device_find(W25Q_SPI_DEVICE_NAME);
//    struct rt_spi_configuration cfg;
//    cfg.data_width = 8;
//    cfg.mode = RT_SPI_MODE_0 | RT_SPI_MSB;  /* SPI Compatible: Mode 0 and Mode 3 */
//    cfg.max_hz = 10 * 1000 * 1000;          /* 1M */
//    rt_spi_configure(handel, &cfg);

    return RT_EOK;
}

